﻿@{
    ViewBag.Title = "MemberTimeTotal";
}

@section scripts
{   
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>       
    <script src="@Url.Content("~/Scripts/common/gridlayout.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/common/export.js")" type="text/javascript"></script>
}
@Html.Partial("~/Views/Modular/BillDetailToolbar.cshtml")
<form id="form1">
    <div id = "DivHeader">
        <table>
            <tr>
                <td width ="70px" align="right">门店名称：</td>
                <td width ="190px">    
                    @Html.Partial("~/Views/Modular/LookupStockInfo.cshtml")
                </td>
                <td width ="70px" align="right">结存情况：</td>
                <td width ="190px">
                    <input id="datatype" name="datatype" class="mini-combobox" style="width:190px;" showNullItem="false"  
                        allowInput="false" align="left" value ="0" data ="comdataType"/>           
                </td>
            </tr>
            <tr>
                <td width ="70px" align="right">次卡方案：</td>
                <td width ="190px">    
                    @Html.Partial("~/Views/Modular/LookupMemberTime.cshtml")
                </td>
                <td width ="70px" align="right">选择会员：</td>
                <td width ="190px">
                    @Html.Partial("~/Views/Modular/LookupMember.cshtml")                      
                </td>
            </tr>
        </table>
    </div>
</form>
        <div class="mini-fit" >
            <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" pageSize="15"
                    borderStyle="border:1;" url="../Report/GetMemberTimeTotal" showSummaryRow="true" allowCellSelect="true" allowCellEdit="true"
                    showColumnsMenu="true"fitColumns="false" ondrawsummarycell="onDrawSummaryCell" sortMode="client" >
                <div property="columns">
                    <div type="checkcolumn" >选行</div>             
                    <div field="FNumber" name="FNumber" width="120" headeralign="center" allowsort="true">会员卡号</div>
                    <div field="FName" name="FName" width="90" headeralign="center" allowsort="true">会员姓名</div>
                    <div field="FPhone" name="FPhone" width="120" headeralign="center" allowsort="true">联系电话</div>
                    <div field="FTimeNumber" name="FTimeNumber" width="100" headeralign="center" allowsort="true">次卡编码</div>
                    <div field="FTimeName" name="FTimeName" width="160" headeralign="center" allowsort="true">次卡名称</div>
                    <div field="FQty" name="FQty" width="80" headeralign="center" align="right" allowsort="true">结存数量</div>
                    <div field="FStartDate" name="FStartDate" width="100" headeralign="center" dateFormat="yyyy-MM-dd" allowsort="true">开始日期</div>
                    <div field="FEndDate" name="FEndDate" width="100" headeralign="center" dateFormat="yyyy-MM-dd" allowsort="true">失效日期</div>
                </div>
            </div>
        </div>

<input type="hidden" id="type" value="@ViewBag.type" />

<script>
    var comdataType = [{ "id": "0", "text": "全部" },
                       { "id": "1", "text": "正常" },
                       { "id": "2", "text": "过期" }]
    var sumFields = "FQty";
    mini.parse();

    //通用shown自动调用些方式
    function FormShown() {
        LoadData();
    }

    //加载资料列表
    function LoadData() {
        var mMemberID = mini.getbyName("FMemberNumber").getValue();
        var mStockID = mini.getbyName("FStockID").getValue();
        var mDataType = mini.getbyName("datatype").getValue();
        var mMemberTimeID = mini.getbyName("FMemberTimeID").getValue();
        var sSystemAppID = parent.window.getSystemAppID();
        var json = "[{";
        json = json + '"mReportType":' + '"4002",';//列表类型
        json = json + '"mSystemAppID":' + '"' + sSystemAppID + '",';
        json = json + '"mMemberID":' + '"' + mMemberID + '",'; 
        json = json + '"mMemberTimeID":' + '"' + mMemberTimeID + '",';
        json = json + '"mStockID":' + '"' + mStockID + '",';
        json = json + '"mDataType":' + '"' + mDataType + '"';
        json = json + "}]";
        var grid = mini.get("datagrid1");
        grid.load({ mydata: json });

        mExportDataUrl = grid.url;
        mExportDataJson = json;//导出
    }

    //搜索资料列表
    function search() {
        LoadData();
    }

    function printdata() {
        var grid = mini.get("datagrid1");
        var url = "../Report/PrintReport";
        mini.open({
            url: url,
            title: "打印", width: 1000, height: 700,
            onload: function () {
                var iframe = this.getIFrameEl();
                var NoneDisplayCol = [0];
                iframe.contentWindow.InitalPrint(grid, NoneDisplayCol, "会员"+mini.get("datatype").getText()+"明细表");
            }
        });
    }

</script>